package com.moneywelcome.userserviceassembly.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.moneywelcome.results.Result;
import com.moneywelcome.userserviceassembly.entity.UserInfo;
import com.moneywelcome.userserviceassembly.entity.UserLogin;
import com.moneywelcome.userserviceassembly.exception.SelUserInfoExecption;
import com.moneywelcome.userserviceassembly.exception.UpdatePasswordExecption;
import com.moneywelcome.userserviceassembly.exception.UserLoginExecption;
import com.moneywelcome.userserviceassembly.mapper.UserInfoMapper;
import com.moneywelcome.userserviceassembly.mapper.UserMapper;
import com.moneywelcome.userserviceassembly.service.UserInfoService;
import com.moneywelcome.userserviceassembly.service.UserService;
import com.moneywelcome.userserviceassembly.util.MyBeanUtils;
import com.moneywelcome.userserviceassembly.util.Sendsms;
import com.woniu.demo.Dto.UserInfoDto;
import com.woniu.demo.param.PageFindUserParam;
import com.woniu.demo.param.PhoneRegisterParam;
import com.woniu.demo.param.UpdatePasswordParam;
import com.woniu.demo.param.UserAccountLoginParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.TimeUnit;


@Service
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements UserInfoService {

    @Override
    public UserInfoDto findUserInfo(Integer userId) {
        QueryWrapper<UserInfo> wrapper = new QueryWrapper<>();
        //查询条件
        wrapper.eq("user_id",userId);
        UserInfo one = getOne(wrapper);
        if (one==null){
            throw new SelUserInfoExecption(10050,"该用户不存在");
        }
        UserInfoDto userInfoDto = MyBeanUtils.copyProperties(one, UserInfoDto.class);
        return userInfoDto;
    }
}



